package cn.linjianhui.thread;

public class OrderExample {
    private int a = 0;
    private boolean flag = false;

    public void writer() {
        a = 1;
        flag = true;
    }

    public void reader() {
        if(flag) {
            int i = a + 1;
            System.out.println(i);
        }
    }
}
